package com.mftour.common.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.mftour.common.cache.InitCache;

/**
 * @author Administrator
 *
 */
public class IdGeneratorUtil {
	
	public static String getId(String prefix){
		SimpleDateFormat sdf=new SimpleDateFormat("yyMMddHHmmssSSS");
		String applicationId=InitCache.applicationId;
		if(applicationId==null){
			applicationId="01";
		}
		if(null!=prefix){
			prefix=prefix.toUpperCase();
		}else{
			prefix="";
		}
		String id=prefix+sdf.format(new Date())+RandomUtil.randomdigit(4)+"-"+applicationId;
		return id;
	}	
}
